package cn.com.my.gallery;

import android.content.Context;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.bumptech.glide.Glide;
import com.chad.library.adapter4.BaseQuickAdapter;
import com.chad.library.adapter4.viewholder.QuickViewHolder;

import java.util.List;

public class ImageFolderAdapter extends BaseQuickAdapter<ImageFolderBean, QuickViewHolder> {

    public ImageFolderAdapter(@NonNull List<? extends ImageFolderBean> items) {
        super(items);
    }

    @NonNull
    @Override
    protected QuickViewHolder onCreateViewHolder(@NonNull Context context, @NonNull ViewGroup viewGroup, int i) {
        return new QuickViewHolder(R.layout.item_image_folder, viewGroup);
    }

    @Override
    protected void onBindViewHolder(@NonNull QuickViewHolder holder, int i, @Nullable ImageFolderBean imageBean) {
        ImageView ivCover = holder.getView(R.id.ivCover);
        TextView tvName = holder.getView(R.id.tvName);
        TextView tvSize = holder.getView(R.id.tvSize);
        Glide.with(ivCover.getContext()).load(imageBean.imageBeans.get(0).data).into(ivCover);
        tvName.setText(imageBean.folder);
        tvSize.setText("数量" + imageBean.size);
    }
}